import 'package:easy_refresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:whale/helper/utils/util.dart';

import '../../../model/page.dart';

abstract class TabSubController<T> extends GetxController {
  late PageModel<T> page = PageModel<T>();

  Future<NetBaseReponse<PageModel>> loadData(
      {EasyRefreshController? refreshCtrl,
      int pageIndex = 1,
      int pageSize = 10}) async {
    final res = await requestForData(pageIndex: pageIndex, pageSize: pageSize);
    page.update(res, refreshCtrl: refreshCtrl);
    update();
    return res;
  }

  Future<NetBaseReponse<PageModel>> requestForData(
      {int pageIndex = 1, int pageSize = 10});

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    loadData();
    super.onReady();
  }
}

// mixin GetcInitDelegate<S extends GetxController> {
//    S init();
// }
